﻿using System.Net.WebSockets;

namespace ARPaintServer.Websocket
{
	public class WebsocketClientCollection
	{
		private static List<WebsocketClient> _clients = new();

		public static void Add(WebsocketClient client)
		{
			_clients.Add(client);
		}

		public static void Remove(WebsocketClient client)
		{
			_clients.Remove(client);
		}

		public static WebsocketClient Get(string clientId)
		{
			var client = _clients.FirstOrDefault(c => c.Id == clientId);

			return client;
		}

		public static List<WebsocketClient> GetAll()
		{
			return _clients;
		}

		public static List<WebsocketClient> GetClientsByRoomNo(string roomId)
		{
			var client = _clients.Where(c => c.RoomId == roomId);
			return client.ToList();
		}
	}
}
